#include "combat.h"

#include <iostream>
using namespace std;

#include "character.h"

combat::combat(character * player, character * enemy1, character * enemy2): 
	hero(player), 
	chosen_one(-1), 
	combat_running(true) 
{
	monster[0] = enemy1;
	monster[1] = enemy2;
}

void combat::choose_enemy(int index) 
{
	chosen_one = index;
	cout << "You will fight a ";
	monster[index]->output_name();
	cout << "!" << endl;
}

void combat::fight() 
{
	character * attacker = hero;
	character * defender = monster[chosen_one];

	attacker->target(this, defender);
	defender->target(this, attacker);

	do {

		attacker->fight_now();
		swap(attacker, defender);

	} while (combat_running);

	cout << "end of fight" << endl;
}
